home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_quik.lha / quickdraw / src / setting_calls.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-09  |  5.4 KB  |  265 lines

  1. /*----------------------------- setting_calls.c ------------------------------*/
  2. /* Copyright 1989 Brown University -- Jeffrey Vogel                           */
  3. /*----------------------------------------------------------------------------*/
  4.  
  5. /*--------------------------------- Includes ---------------------------------*/
  6. /*----------------------------------------------------------------------------*/
  7.  
  8. #include "qd_local.h"
  9.  
  10.  
  11. /*------------------------------- SetLineWidth -------------------------------*/
  12. /*----------------------------------------------------------------------------*/
  13.  
  14. void
  15. SetLineWidth(lineWidth)
  16. int  lineWidth;
  17. {
  18.   /*** error check ***/
  19.   if (!QDrunning) {
  20.      QDerror("ERROR SetLineWidth: QuickDraw not initialized.");
  21.      return;
  22.   }
  23.   if ((lineWidth < LINE_WIDTH__MIN) || (lineWidth > LINE_WIDTH__MAX)) {
  24.      QDerror("ERROR SetLineWidth: Illegal line width.");
  25.      return;
  26.   }
  27.  
  28.    QDgcValues.line_width = lineWidth;
  29.    XChangeGC(QDdisplay, QDgc, GCLineWidth, &QDgcValues);
  30. }
  31.  
  32. /*------------------------------- GetLineWidth -------------------------------*/
  33. /*----------------------------------------------------------------------------*/
  34.  
  35. void
  36. GetLineWidth(lineWidth)
  37. int  *lineWidth;
  38. {
  39.    if (!QDrunning) {
  40.      QDerror("ERROR GetLineWidth: QuickDraw not initialized.");
  41.      return;
  42.    }
  43.  
  44.    *lineWidth = QDgcValues.line_width;
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. /*------------------------------- SetLineStyle -------------------------------*/
  68. /*----------------------------------------------------------------------------*/
  69.  
  70. void
  71. SetLineStyle(style)
  72. LineStyles  style;
  73. {
  74.    if (!QDrunning) {
  75.      QDerror("ERROR SetLineStyle: QuickDraw not initialized.");
  76.      return;
  77.    }
  78.  
  79.    if (style == LINE_STYLE__SOLID) {
  80.       QDgcValues.line_style = LineSolid;
  81.       XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
  82.    }      
  83.    else if (style == LINE_STYLE__ON_OFF_DASH) {
  84.       QDgcValues.line_style = LineOnOffDash;
  85.       XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
  86.    }
  87.    else if (style == LINE_STYLE__DOUBLE_DASH) {
  88.       QDgcValues.line_style = LineDoubleDash;
  89.       XChangeGC(QDdisplay, QDgc, GCLineStyle, &QDgcValues);
  90.    }
  91.    else {
  92.       QDerror("ERROR SetLineStyle: Invalid line style.");
  93.    }
  94. }
  95.    
  96.  
  97. /*------------------------------- GetLineStyle -------------------------------*/
  98. /*----------------------------------------------------------------------------*/
  99.  
  100. void
  101. GetLineStyle(style)
  102. LineStyles  *style;
  103. {
  104.    if (!QDrunning) {
  105.      QDerror("ERROR GetLineStyle: QuickDraw not initialized.");
  106.      return;
  107.    }
  108.  
  109.    switch (QDgcValues.line_style) {
  110.     case LineSolid:
  111.       *style = LINE_STYLE__SOLID;
  112.       break;
  113.     case LineOnOffDash:
  114.       *style = LINE_STYLE__ON_OFF_DASH;
  115.       break;
  116.     case LineDoubleDash:
  117.       *style = LINE_STYLE__DOUBLE_DASH;
  118.       break;
  119.    }
  120. }
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. /*--------------------------------- PenMode ----------------------------------*/
  134. /*----------------------------------------------------------------------------*/
  135.  
  136. void
  137. PenMode(mode)
  138. PenModes  mode;
  139. {
  140.    if (!QDrunning) {
  141.      QDerror("ERROR PenMode: QuickDraw not initialized.");
  142.      return;
  143.    }
  144.  
  145.    if (mode == patXor) {
  146.       QDgcValues.function = GXxor;
  147.       XChangeGC(QDdisplay, QDgc, GCFunction, &QDgcValues);
  148.    }
  149.    else if (mode == patCopy) {
  150.       QDgcValues.function = GXcopy;
  151.       XChangeGC(QDdisplay, QDgc, GCFunction, &QDgcValues);
  152.    }
  153.    else {
  154.       QDerror("ERROR PenMode: Invalid write mode.");
  155.    }
  156. }
  157.    
  158.  
  159. /*-------------------------------- GetPenMode --------------------------------*/
  160. /*----------------------------------------------------------------------------*/
  161.  
  162. void
  163. GetPenMode(mode)
  164. PenModes  *mode;
  165. {
  166.    if (!QDrunning) {
  167.      QDerror("ERROR GetPenMode: QuickDraw not initialized.");
  168.      return;
  169.    }
  170.  
  171.    switch (QDgcValues.function) {
  172.     case GXcopy:
  173.       *mode = patCopy;
  174.       break;
  175.     case GXxor:
  176.       *mode = patXor;
  177.       break;
  178.    }
  179. }
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. /*--------------------------------- SetFont ----------------------------------*/
  200. /*----------------------------------------------------------------------------*/
  201.  
  202. void
  203. SetFont(font)
  204. Fonts  font;
  205. {
  206.    if (!QDrunning) {
  207.      QDerror("ERROR SetFont: QuickDraw not initialized.");
  208.      return;
  209.    }
  210.  
  211.    if (font == FONT__SMALL) {
  212.       QDgcValues.font = QDfonts[FONT__SMALL];
  213.       XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
  214.    }      
  215.    else if (font == FONT__MEDIUM) {
  216.       QDgcValues.font = QDfonts[FONT__MEDIUM];
  217.       XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
  218.    }
  219.    else if (font == FONT__LARGE) {
  220.       QDgcValues.font = QDfonts[FONT__LARGE];
  221.       XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
  222.    }
  223.    else if (font == FONT__LARGEST) {
  224.       QDgcValues.font = QDfonts[FONT__LARGEST];
  225.       XChangeGC(QDdisplay, QDgc, GCFont, &QDgcValues);
  226.    }
  227.    else {
  228.       QDerror("ERROR SetFont Invalid font.");
  229.    }
  230. }
  231.  
  232. /*--------------------------------- GetFont ----------------------------------*/
  233. /*----------------------------------------------------------------------------*/
  234.  
  235. void
  236. GetFont(font)
  237. Fonts  *font;
  238. {
  239.    if (!QDrunning) {
  240.      QDerror("ERROR GetFont: QuickDraw not initialized.");
  241.      return;
  242.    }
  243.  
  244.    if (QDgcValues.font == QDfonts[FONT__SMALL]) 
  245.       *font = FONT__SMALL;
  246.    else if (QDgcValues.font == QDfonts[FONT__MEDIUM]) 
  247.       *font = FONT__MEDIUM;
  248.    else if (QDgcValues.font == QDfonts[FONT__LARGE]) 
  249.       *font = FONT__LARGE;
  250.    else if (QDgcValues.font == QDfonts[FONT__LARGEST]) 
  251.       *font = FONT__LARGEST;
  252. }
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.